<!DOCTYPE html>
<html lang="en">
<head>

	<meta charset="utf-8">
	<title>Edit Appliance</title>
	<link rel="stylesheet" href="<?php echo base_url();?>/application/development-bundle/themes/custom-theme/jquery.ui.all.css">
	<link rel="stylesheet" href="<?php echo base_url();?>/application/css/style.css">
	<script src="<?php echo base_url();?>/application/development-bundle/jquery-1.4.4.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.core.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.widget.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.accordion.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.datepicker.js"></script>
	<link rel="stylesheet" href="<?php echo base_url();?>/application/development-bundle/demos/demos.css">
	
	<style>
		#accordion {width: 310px;}
	</style>
	
	<script>
	$(function() {
		$( "#accordion" ).accordion({
			autoHeight: false,
			navigation: true,
			collapsible: true
		});
	});
	</script>
	
	<script>
	$(function() {
		$( "#datepicker" ).datepicker({
			changeMonth: true,
			changeYear: true,
			dateFormat: 'yy/mm/dd',
			yearRange: '1950:2099'
		});
	});
	</script>
	
	<script>
	function OnSubmitForm(){
		if(document.pressed == "Save Changes"){
			if(document.adminform.student_number.value!=""){
				document.adminform.action ="<?php echo base_url();?>/index.php/applianceController/editAppliance";
				return true;
			}else{
				alert("Please enter student number!");
				return false;
			}
		
		}else if(document.pressed == "Main Menu"){
			document.adminform.action ="<?php echo base_url();?>/index.php/adminPageController";
			return true;
		}
	}
	</script>
	
</head>

<body>

<div class="demo">
	
	<div id="header"><h1>ACCI eXtreme Information System</h1></div>

	<div id="accordion">
	
		<h3><a href="#section1">Edit an Appliance</a></h3>
		<form name="adminform" method="post" onSubmit="return OnSubmitForm();">
			<h3>Appliance Information for</h3>
			<div>
				<?php
					if($data->num_rows()>0){
						$row = $data->row();
						echo "<b>".$row->first_name.' '.$row->middle_name.' '.$row->last_name."<br/>";
						echo $row->student_number."</b>";	
						echo "<input type=\"hidden\" name=\"student_number\" value=\"$row->student_number\">";
						echo "<br/>";
					}	
				?>
				<?php if($data->num_rows()>0){?>
				<ul>
				<?php foreach($data->result() as $row):?>
					<li>
					<a href="<?php echo base_url();?>/index.php/applianceController/loadEditApplianceView2/<?php echo $row->student_number; ?>/<?php echo $row->type_of_appliance; ?>">
						<?php echo $row->type_of_appliance; ?>
					</a>
					</li>
				<?php endforeach;?>
				</ul>
				<?php }else{?>
					Student not found<br/><br/>
				<?php }?>
			</div>
			<input type="submit" value="Main Menu" onClick="document.pressed=this.value" />
		</form>
		
	</div><!-- End accordion -->

</div><!-- End demo -->

</body>
</html>
